﻿<template>
    <div>
        <div class="layout-main">
            <el-row style="margin-bottom:12px">
                <el-button v-on:click="add()" size="small" type="primary">添加</el-button>
            </el-row>
            <el-form ref="wmsWaybillItem" label-position="right" :label-width="80" :model="wmsWaybillItem" :rules="rules">
                <input type="hidden" :model="wmsWaybillItem.id" />
                                                                                <el-form-item label="" prop="pics">
                                        <el-input v-model="wmsWaybillItem.pics" placeholder="" style="width: 240px" />
                                    </el-form-item>
                                                                <el-form-item label="" prop="productId">
                                        <el-input v-model="wmsWaybillItem.productId" placeholder="" style="width: 240px" />
                                    </el-form-item>
                                                                <el-form-item label="" prop="quantity">
                                        <el-input v-model="wmsWaybillItem.quantity" placeholder="" style="width: 240px" />
                                    </el-form-item>
                                                                <el-form-item label="" prop="remark">
                                        <el-input v-model="wmsWaybillItem.remark" placeholder="" style="width: 240px" />
                                    </el-form-item>
                                                                <el-form-item label="" prop="waybillId">
                                        <el-input v-model="wmsWaybillItem.waybillId" placeholder="" style="width: 240px" />
                                    </el-form-item>
                                            </el-form>
            <div>
                <el-button size="small" @click="cancel">取消</el-button>
                <el-button size="small" type="primary" :loading="modalLoading" @click="ok">确定</el-button>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    name: 'WmsWaybillItem',
    data() {
        return {
            loading: false,
            modalLoading: false,

            others: {

            },
            wmsWaybillItem: {

            },
            rules: {},
            wmsWaybillItemId: null
        };
    },
    mounted: function() {
        this.wmsWaybillItemId = this.$route.params.wmsWaybillItemId;
        this.getDetail();

    },
    methods: {
        cbtime: function(value) {
            this.others;
        },
        getDetail: function() {
            if (this.wmsWaybillItemId == null || this.wmsWaybillItemId == undefined || this.wmsWaybillItemId == "") return;
            var me = this;
            me.showLoading();
            me.$http.post("/sys/wmswaybillitem/show_" + me.wmsWaybillItemId + ".action").then(response => {
                var body = response;
                if (body.status == 0) {
                    me.wmsWaybillItem= body.obj;

                }
                me.hideLoading();
            }, response => {
                me.hideLoading();
            });
        },

        ok: function() {
            var ok = false;
            this.$refs['wmsWaybillItem'].validate((valid) => {
                ok = valid;
                if (valid) {

                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            if (!ok) return;
            var me = this;

            me.modalLoading = true;
            me.$http.post("/sys/wmswaybillitem/doSave.action", me.wmsWaybillItem).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("保存成功！");

                    me.modalEdit = false;

                } else {
                    me.errorMessage(body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.getDetail();
        }
    }
}
</script>
<style scoped>
</style>